<template>
	<div @click.stop="onClickHandler()" :class="[selected ?'row-selected-state ' : 'row-normal-state ']" style="position: relative;">
		<i class="el-icon-rank drag-widget" style="position: absolute;left: 0px;top:0px;z-index: 100;" v-show="selected"></i>
		WebSocket
	</div>
</template>

<script>
	import utils from '@/utils/utils.js';
	import formDesignerUtil from '@/utils/formDesignerUtil.js';
	export default {
		name: "DesignWebSocketComponent",
		props: [
			"componentModel"
		],
		data() {
			return {
				selected: false,
				"propertySet": [{
						"key": "ID",
						"label": "ID",
						"editor": "label"
					},
					{
						"key": "connectionString",
						"label": "链接字符串",
						"editor": "textarea"
					}
				]
			}
		},
		inject: ['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			onClickHandler() {
				formDesignerUtil.componentClickHandler(this);
			},
			setSelected(selected) {
				this.selected = selected;
			},
			getPropertyValue(propertyKey) {
				if(propertyKey=="ID"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"id");
				}else if(propertyKey=="connectionString"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"connectionString");
				}
				return formDesignerUtil.getComponentModelCommonValue(this.componentModel,propertyKey);
			},
			setPropertyValue(propertyKey, propertyValue) {
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,propertyKey, propertyValue);
				if(propertyKey=="connectionString"){
					formDesignerUtil.setComponentModelPropValue(this.componentModel,"connectionString",propertyValue);
				}
			}
		}
	}
</script>

<style>
</style>
